package com.restaurant.application.indexes.exchangegoodslist;

import com.nebutown.description.DataTypes;
import com.nebutown.description.IndexGen;
import com.nebutown.description.UnitDescription;
import com.nebutown.description.data.Contributor;
import com.nebutown.description.data.IndexUnit;
import com.nebutown.description.data.SQLColumn;
import com.restaurant.application.accumulategoods.AccumulateGoods;
import com.restaurant.application.exchangegoods.ExchangeGoods;
import com.restaurant.application.genshanguser.GenShangUser;
import com.restaurant.application.indexes.exchangegoodslist.mysql.ExchangeGoodsListCriteria;

public class AssistExchangeListDesc extends UnitDescription {

    public static void main(String[] args) {
        UnitDescription desc = UnitDescription.basicUnit(AssistExchangeList.class, null);
        desc
                .addUiFunction("doSearch", ExchangeGoodsListCriteria.class.getName())
        ;

        desc.run("./");
        IndexGen.run(getDescription(), "src/main/java");
    }

    public static IndexUnit getDescription() {
        return new IndexUnit()
                .withName("ExchangeGoodsList")
                .withPackageName(AssistExchangeListDesc.class.getPackage().getName() + ".mysql")
                .withSrcLocation("./")
                .addContributors(new Contributor()
                        .withName("ExchangeGoods")
                        .withNullable(false)
                        .withUnique(true)
                        .withUnitType(ExchangeGoods.class.getName())
                        .addContribution(new SQLColumn()
                                .withName("accumulate")
                                .withType(DataTypes.LONG)
                                .withLabel("兑换积分")
                                .withWidth(255))
                        .addContribution(new SQLColumn()
                                .withName("createTime")
                                .withType(DataTypes.LONG)
                                .withLabel("创建时间")
                                .withWidth(255)))
                .addContributors(new Contributor()
                        .withName("customerUid")
                        .withNullable(false)
                        .withUnique(true)
                        .withUnitType(GenShangUser.class.getName())
                        .addContribution(new SQLColumn()
                                .withName("customerId")
                                .withType(DataTypes.STRING)
                                .withLabel("客户名")
                                .withWidth(255))
                        .addContribution(new SQLColumn()
                                .withName("phone")
                                .withType(DataTypes.STRING)
                                .withLabel("客户电话")
                                .withWidth(255))
                        .addContribution(new SQLColumn()
                                .withName("nickName")
                                .withType(DataTypes.STRING)
                                .withLabel("客户昵称")
                                .withWidth(255)))
                .addContributors(new Contributor()
                        .withName("goodsUID")
                        .withNullable(false)
                        .withUnique(true)
                        .withUnitType(AccumulateGoods.class.getName())
                        .addContribution(new SQLColumn()
                                .withName("goodsName")
                                .withType(DataTypes.STRING)
                                .withLabel("商品名称")
                                .withWidth(255))
                        .addContribution(new SQLColumn()
                                .withName("goodsId")
                                .withType(DataTypes.STRING)
                                .withLabel("商品Id")
                                .withWidth(255))

                );
    }
}
